// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-05-15',
  devtools: { enabled: false },
  modules: ['@unocss/nuxt', '@pinia/nuxt'],
  // 网站基础信息配置
  app: {
    head: {
      htmlAttrs: { lang: 'zh-CN' },
      title: '球球助手 - 足球数据分析平台',
      meta: [
        // 基础 meta
        { charset: 'utf-8' },
        { name: 'applicable-device', content: 'pc,mobile' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        // SEO 核心 meta
        {
          name: 'description',
          content: '球球助手是专业的足球数据分析平台，提供比赛数据、历史战绩、球队信息等公开数据查询服务，帮助足球爱好者更好地了解比赛。',
        },
        { name: 'keywords', content: '球球助手,足球数据,比赛分析,球队信息,足球统计,数据查询,足球资讯' },
        { name: 'robots', content: 'index, follow' },
        // 针对百度搜索、360搜索、搜狗搜索、神马搜索、谷歌搜索
        { name: 'baidu-site-verification', content: 'codeva-iSMZPJ8J23' },
        { name: '360-site-verification', content: '3b0744d3ee39052c61c0447c2139c7b2' },
        { name: 'shenma-site-verification', content: '03285d4b189c8aa020fb165789694d71_1762744321' },
        { name: 'google-site-verification', content: '-F9EO6OccaqYxTranCgxdFtZTSSYKJdB7pUuT8OShcw' },
      ],
      link: [
        { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' },
        { rel: 'apple-touch-icon', href: '/logo.svg' },
      ],
      script: [
        // 接入百度统计
        { src: 'https://hm.baidu.com/hm.js?2462b53d4e5a8baafdeb8df4cec7092c', async: true },
      ],
    },
  },

  pinia: {
    storesDirs: ['./stores/**'],
  },

  devServer: {
    port: 4379,
  },

  runtimeConfig: {
    // 仅在服务端可用的私有键
    apiSecret: '123',
    // public 中的键也会暴露给客户端
    public: {
      distancePercent: 15,
      startShowRating: 8,
      apiBase: '',
      siteUrl: 'https://your-domain.com',
    },
  },

  // CSS配置
  css: ['~/assets/scss/theme.scss'],

  // SSR和预渲染优化
  ssr: true,
  nitro: {
    preset: 'node-server',
    prerender: {
      routes: [
        '/',
        '/login',
        '/register',
        '/forget-password',
        '/about',
        '/card-exchange',
        '/card-redeem',
        '/feedback',
        '/user-agreement',
        '/privacy-policy',
        '/guess-football',
        '/guess-basketball',
        '/recommend-football',
        '/football-detail',
        '/releases',
      ],
    },
    compressPublicAssets: true,
  },

  // 性能优化
  experimental: {
    payloadExtraction: false,
  },

  // 构建优化
  build: {
    transpile: ['@headlessui/vue'],
  },
});
